package com.ds.infrastructure.hyperspace.console.model.request.deploy.deploydata;

import com.ds.infrastructure.hyperspace.console.dto.deploydata.PackageInfoDTO;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;

/**
 * @author: yaozhendong
 * @create: 2019-10-21 10:47
 **/
@Data
@NoArgsConstructor
public class PackageInfoForm {
    @NotBlank
    private String name;
    @NotBlank
    private String version;

    public static PackageInfoDTO toDTO(PackageInfoForm form) {
        PackageInfoDTO packageInfoDTO = new PackageInfoDTO();
        packageInfoDTO.setName(form.getName());
        packageInfoDTO.setVersion(form.getVersion());
        return packageInfoDTO;
    }

    public static PackageInfoForm toVO(PackageInfoDTO dto) {
        PackageInfoForm packageInfoForm = new PackageInfoForm();
        packageInfoForm.setName(dto.getName());
        packageInfoForm.setVersion(dto.getVersion());
        return packageInfoForm;
    }
}
